Coding A Christmas Tree with Python in 10 Minutes (A Beginner-Friendly Project)

python
youtube
Coding A Christmas Tree with Python in 10 Minutes (A Beginner-Friendly Project) #Programming #Python #pythonproject Christmas Tree Python Program Project for Beginners! This script prints a simple ASCII Christmas tree made of stars (*) and a trunk made of vertical bars (|). The Code is below: # --------------------------------------------- # Christmas Tree Program in Python # This script prints a simple ASCII Christmas tree # made of stars (*) and a trunk made of vertical bars (|). # --------------------------------------------- # Set the height of the tree (number of star layers) height = 10 # You can change this to make the tree taller or shorter # ----------------------------- # Build the leafy part of the tree # ----------------------------- for i in range(height): # Number of spaces before the stars (centers the tree) spaces = ' ' * (height - i - 1) # Number of stars for this row (odd numbers: 1, 3, 5, ...) stars = '*' * (2 * i + 1) # Print one row of the tree print(spaces + stars) # ----------------------------- # Build the trunk of the tree # ----------------------------- trunk_width = 3 # Width of the trunk (number of | characters) trunk_height = 3 # Height of the trunk (number of rows) # Center the trunk under the tree trunk_spaces = ' ' * (height - trunk_width // 2 - 1) #Produce a string of n spaces where n is (height - trunk_width // 2 - 1). Note '//' is integer division (e.g. 5 // 2 = 2 and not 2.5) for _ in range(trunk_height): print(trunk_spaces + '|' * trunk_width) ▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
  2025/12/25      youtube

関連するプログラミング動画 [python]

Our Tag

最近投稿されたプログラミング学習動画

🔥Vibe Coders vs Real Coders| Who Wins in AI Era 2026? #simplilearn #sh

Tired of buggy AI-generated messes? Disc...

  2026/01/25

Python for Data Science Full Course 2026 [Free] | Learn Data Science W

python

🔥Applied Generative AI Specialization, d...

  2026/01/25

Power BI Full Course 2026 [FREE] | Learn Power BI in 9 Hours | Power B

🔥Data Analyst Masters Program (Discount ...

  2026/01/25

How to Write a Well-Structured Prompt? | Prompt Engineering | #Shorts

This #shorts video by #simplilearn on Le...

  2026/01/25

Figma Full Course 2026 | Figma Web Design Full Course | Figma UI UX De

Design

🔥UX/UI Design Program with Generative AI...

  2026/01/25

TerraForm Full Course 2026 | TerraForm Tutorial for Beginners | TerraF

️🔥 Cloud Architect Masters Program - ️ ️...

  2026/01/25

Why debugging vibe-coded projects is hard - and what to do instead

Debugging vibe-coded projects is hard. W...

  2026/01/25

These are very important for you to learn in Python.

python

DevLaunch is my mentorship program where...

  2026/01/24

How Black Stops the Tabs vs Spaces Fight

python

Download your free Python Cheat Sheet he...

  2026/01/24

How to Install XAMPP on Mac | Install XAMPP on macOS (2026)

How to Install XAMPP on Mac | Install XA...

  2026/01/24

Sure, grades matter in school - but on the job market, hands-on experi

Sure, grades matter in school - but on t...

  2026/01/24

Learn Matplotlib in 30 Minutes - Python Matplotlib Tutorial

python

👉 To learn for free on Brilliant, go to ...

  2026/01/24

How to Install and Setup Keras on Windows 11 (2026)

Microsoft

How to Install and Setup Keras on Window...

  2026/01/24

How to Install and Configure Azure CLI on Windows 11

azure
Microsoft

Installing and configuring Azure CLI on ...

  2026/01/24

Mutability in Python.

python

DevLaunch is my mentorship program where...

  2026/01/23

Continuing to Improve the Learning Experience at Real Python | Real Py

python
study

If you haven't visited the Real Python w...

  2026/01/23